﻿using Aliphant.Datas;

namespace Aliphant.Interfaces
{
    public interface IUIContainer : IDisposable
    {
        #region 依赖注入

        void Register<TService>() where TService : class, new();

        void Register<TService>(Func<TService> factory) where TService : class;

        void Register<TService>(string name) where TService : class, new();

        void RegisterNavigation<TService>(string name) where TService : class, new();

        void RegisterRegion<TService>(TService region, string regionName) where TService : class, new();

        void RegisterFactory<TService>(string name) where TService : class, new();

        #endregion

        bool Contains<TService>();

        bool ContainsKey(string key);

        TService Resolve<TService>() where TService : class, new();

        TService Resolve<TService>(string name) where TService : class, new();

        /// <summary>
        /// 获取实例
        /// </summary>
        /// <param name="name"></param>
        /// <returns></returns>
        object Resolve(string name);

        /// <summary>
        /// 获取新实例
        /// </summary>
        /// <param name="name"></param>
        /// <returns></returns>
        object ResolveNew(string name);

        TService ResolveNew<TService>(string name) where TService : class, new();

        void NavigateTo(string region, string name, NavigateParameter navigateParameter);

        void NavigateTo(string region, string name);

        void CancelRegister(string name);

        void AddUIModule<TModule>() where TModule : IUIModule, new();

        List<object> GetAllServices();
    }
}
